﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;

public partial class ForgotPassword : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //SetActiveButtonAttributes((PasswordRecovery.)PasswordRecovery1.FindControl("SendEmailButton"));
            //SetActiveButtonAttributes((Button)PasswordRecovery1.FindControl("CancelButton"));
            if (Request.IsAuthenticated)
                Response.Redirect("/default.aspx");
        }
    }

    private void SetActiveButtonAttributes(Button button)
    {
        button.Attributes.CssStyle.Add("background-color", "#eee");
        button.Attributes.Add("OnMouseOut", "this.style.backgroundColor ='#eee';");
        button.Attributes.CssStyle.Add("text-decoration", "none");
        button.Attributes.CssStyle.Add("margin", "3px");
        button.Attributes.CssStyle.Add("padding", "7px 6px 7px 6px");
        button.Attributes.Add("OnMouseOver", "this.style.backgroundColor ='#ddd';");
    }

    protected void Cancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("/default.aspx");
    }

    #region send carbon copy to webmaster

    // this code sends a duplicate email to the webmaster (address below must be corrected)
    // we could have done this from the MailDefinitions property window but it was more fun this way
    protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        e.Message.IsBodyHtml = true;
        //e.Message.CC.Add("admin@sueetie.org");
    }

    #endregion

}
